package com.uqbar.game.asteroid.tipe;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;

import com.uqbar.game.random.RandomAsteroid;
import com.uqbar.game.scene.PlayScene;
public class MediumAsteroid extends Asteroid {

	private PlayScene scene;
	private double dirX, dirY;
	private int x, y;
	private int diameter = 40;
	private int speed;
	private Color color = Color.MAGENTA;
	private RandomAsteroid randomAsteroid; 
	
	public MediumAsteroid(int x, int y, int speed, double dirX, double dirY, RandomAsteroid randomAsteroid) {
		super(x, y, speed, dirX, dirY);		
		this.x = x;
		this.y = y;
		this.dirX = dirX;
		this.dirY = dirY;
		this.speed = speed;
		this.randomAsteroid = randomAsteroid;
		this.scene = randomAsteroid.getPlayScene();
//		this.setAppearance(new Circle(color, diameter));

		this.initializeAnimations(this.diameter);
		this.setAppearance(this.getAsteroidAnimation());
	}

	@Override
	public void exploit() {
		this.destroy();
		
		SmallAsteroid a1 = new SmallAsteroid(x, y, speed, -dirX, -dirY);
		SmallAsteroid a2 = new SmallAsteroid(x, y, speed, dirX, dirY);

		this.scene.getCurrentScene().addComponent(a1);
		this.scene.getCurrentScene().addComponent(a2);

		List<Asteroid> asteroidAdd = new ArrayList<Asteroid>();
		asteroidAdd.add(a1);
		asteroidAdd.add(a2);
		
		this.randomAsteroid.add(asteroidAdd);
	}
	
	public int getDiameter() {
		return this.diameter;
	}

	protected void alignWithDiameter() {
		this.align(diameter);
	}
	
	public int getScore() {
		return 75;
	}
}
